Change in openvpn[master]: Add new unit test module test_socket
A message that is not in the archive (sent off-list or not yet received): gerrit.1756402061000.If546f64a4554b292623bfcfe9ee53bac17dfa803@...2715...
Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/1160?usp=email
to review the following change.
Change subject: Add new unit test module test_socket
......................................................................
Add new unit test module test_socket
With a first UT that tests add_in6_addr() (andprint_in6_addr implicitly).
---
M CMakeLists.txt
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/mock_management.c
A tests/unit_tests/openvpn/test_socket.c
4 files changed, 155 insertions(+), 10 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/60/1160/1
CMakeLists.txt +10 -0
@@ -653,6 +653,7 @@ "test_packet_id" "test_pkt" "test_provider" + "test_socket" "test_ssl" "test_user_pass" "test_push_update_msg"
@@ -849,6 +850,15 @@ src/openvpn/base64.c ) + target_sources(test_socket PRIVATE + tests/unit_tests/openvpn/mock_get_random.c + tests/unit_tests/openvpn/mock_management.c + tests/unit_tests/openvpn/mock_win32_execve.c + src/openvpn/env_set.c + src/openvpn/run_command.c + src/openvpn/socket_util.c + ) + target_sources(test_user_pass PRIVATE tests/unit_tests/openvpn/mock_get_random.c tests/unit_tests/openvpn/mock_win32_execve.c
tests/unit_tests/openvpn/Makefile.am +22 -10
@@ -4,23 +4,17 @@ AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING) Unit-Tests' -test_binaries= +test_binaries = crypto_testdriver packet_id_testdriver auth_token_testdriver \ + ncp_testdriver misc_testdriver pkt_testdriver ssl_testdriver \ + user_pass_testdriver push_update_msg_testdriver provider_testdriver socket_testdriver if HAVE_LD_WRAP_SUPPORT test_binaries += argv_testdriver buffer_testdriver -endif - -test_binaries += crypto_testdriver packet_id_testdriver auth_token_testdriver ncp_testdriver misc_testdriver \ - pkt_testdriver ssl_testdriver user_pass_testdriver push_update_msg_testdriver - -if HAVE_LD_WRAP_SUPPORT if !WIN32 test_binaries += tls_crypt_testdriver endif endif -test_binaries += provider_testdriver - if WIN32 test_binaries += cryptoapi_testdriver LDADD = -lws2_32
@@ -343,4 +337,22 @@ $(top_srcdir)/src/openvpn/platform.c \ $(top_srcdir)/src/openvpn/push_util.c \ $(top_srcdir)/src/openvpn/options_util.c \ - $(top_srcdir)/src/openvpn/otime.c + $(top_srcdir)/src/openvpn/otime.c + +socket_testdriver_CFLAGS = \ + -I$(top_srcdir)/include -I$(top_srcdir)/src/compat -I$(top_srcdir)/src/openvpn \ + -DSOURCEDIR=\"$(top_srcdir)\" @TEST_CFLAGS@ + +socket_testdriver_LDFLAGS = @TEST_LDFLAGS@ + +socket_testdriver_SOURCES = test_socket.c \ + mock_msg.c test_common.h \ + mock_get_random.c \ + mock_management.c \ + $(top_srcdir)/src/openvpn/buffer.c \ + $(top_srcdir)/src/openvpn/win32-util.c \ + $(top_srcdir)/src/openvpn/platform.c \ + $(top_srcdir)/src/openvpn/env_set.c \ + $(top_srcdir)/src/openvpn/run_command.c \ + $(top_srcdir)/src/openvpn/socket_util.c +
tests/unit_tests/openvpn/mock_management.c +15 -0
@@ -46,4 +46,19 @@ {return NULL ; } + +void +management_set_state (struct management *man,const int state,const char *detail, +const in_addr_t *tun_local_ip,const struct in6_addr *tun_local_ip6, +const struct openvpn_sockaddr *local_addr, +const struct openvpn_sockaddr *remote_addr) +{ +} + +void +management_sleep (const int n) +{ +} + +#endif
tests/unit_tests/openvpn/test_socket.c new file +108 -0
108 lines not on this page · raw message
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1160?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: If546f64a4554b292623bfcfe9ee53bac17dfa803
Gerrit-Change-Number: 1160
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-MessageType: newchange
Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1160?usp=email
to look at the new patch set (#2).
Change subject: Add new unit test module test_socket
......................................................................
Add new unit test module test_socket
With a first UT that tests add_in6_addr() (andprint_in6_addr implicitly).
---
M CMakeLists.txt
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/mock_management.c
A tests/unit_tests/openvpn/test_socket.c
4 files changed, 158 insertions(+), 10 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/60/1160/2
CMakeLists.txt +10 -0
@@ -653,6 +653,7 @@ "test_packet_id" "test_pkt" "test_provider" + "test_socket" "test_ssl" "test_user_pass" "test_push_update_msg"
@@ -849,6 +850,15 @@ src/openvpn/base64.c ) + target_sources(test_socket PRIVATE + tests/unit_tests/openvpn/mock_get_random.c + tests/unit_tests/openvpn/mock_management.c + tests/unit_tests/openvpn/mock_win32_execve.c + src/openvpn/env_set.c + src/openvpn/run_command.c + src/openvpn/socket_util.c + ) + target_sources(test_user_pass PRIVATE tests/unit_tests/openvpn/mock_get_random.c tests/unit_tests/openvpn/mock_win32_execve.c
tests/unit_tests/openvpn/Makefile.am +22 -10
@@ -4,23 +4,17 @@ AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING) Unit-Tests' -test_binaries= +test_binaries = crypto_testdriver packet_id_testdriver auth_token_testdriver \ + ncp_testdriver misc_testdriver pkt_testdriver ssl_testdriver \ + user_pass_testdriver push_update_msg_testdriver provider_testdriver socket_testdriver if HAVE_LD_WRAP_SUPPORT test_binaries += argv_testdriver buffer_testdriver -endif - -test_binaries += crypto_testdriver packet_id_testdriver auth_token_testdriver ncp_testdriver misc_testdriver \ - pkt_testdriver ssl_testdriver user_pass_testdriver push_update_msg_testdriver - -if HAVE_LD_WRAP_SUPPORT if !WIN32 test_binaries += tls_crypt_testdriver endif endif -test_binaries += provider_testdriver - if WIN32 test_binaries += cryptoapi_testdriver LDADD = -lws2_32
@@ -343,4 +337,22 @@ $(top_srcdir)/src/openvpn/platform.c \ $(top_srcdir)/src/openvpn/push_util.c \ $(top_srcdir)/src/openvpn/options_util.c \ - $(top_srcdir)/src/openvpn/otime.c + $(top_srcdir)/src/openvpn/otime.c + +socket_testdriver_CFLAGS = \ + -I$(top_srcdir)/include -I$(top_srcdir)/src/compat -I$(top_srcdir)/src/openvpn \ + -DSOURCEDIR=\"$(top_srcdir)\" @TEST_CFLAGS@ + +socket_testdriver_LDFLAGS = @TEST_LDFLAGS@ + +socket_testdriver_SOURCES = test_socket.c \ + mock_msg.c test_common.h \ + mock_get_random.c \ + mock_management.c \ + $(top_srcdir)/src/openvpn/buffer.c \ + $(top_srcdir)/src/openvpn/win32-util.c \ + $(top_srcdir)/src/openvpn/platform.c \ + $(top_srcdir)/src/openvpn/env_set.c \ + $(top_srcdir)/src/openvpn/run_command.c \ + $(top_srcdir)/src/openvpn/socket_util.c +
tests/unit_tests/openvpn/mock_management.c +15 -0
@@ -46,4 +46,19 @@ {return NULL ; } + +void +management_set_state (struct management *man,const int state,const char *detail, +const in_addr_t *tun_local_ip,const struct in6_addr *tun_local_ip6, +const struct openvpn_sockaddr *local_addr, +const struct openvpn_sockaddr *remote_addr) +{ +} + +void +management_sleep (const int n) +{ +} + +#endif
tests/unit_tests/openvpn/test_socket.c new file +111 -0
111 lines not on this page · raw message
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1160?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: If546f64a4554b292623bfcfe9ee53bac17dfa803
Gerrit-Change-Number: 1160
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1160?usp=email
to look at the new patch set (#3).
Change subject: Add new unit test module test_socket
......................................................................
Add new unit test module test_socket
With a first UT that tests add_in6_addr() (andprint_in6_addr implicitly).
---
M CMakeLists.txt
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/mock_management.c
A tests/unit_tests/openvpn/test_socket.c
4 files changed, 157 insertions(+), 10 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/60/1160/3
CMakeLists.txt +10 -0
@@ -653,6 +653,7 @@ "test_packet_id" "test_pkt" "test_provider" + "test_socket" "test_ssl" "test_user_pass" "test_push_update_msg"
@@ -849,6 +850,15 @@ src/openvpn/base64.c ) + target_sources(test_socket PRIVATE + tests/unit_tests/openvpn/mock_get_random.c + tests/unit_tests/openvpn/mock_management.c + tests/unit_tests/openvpn/mock_win32_execve.c + src/openvpn/env_set.c + src/openvpn/run_command.c + src/openvpn/socket_util.c + ) + target_sources(test_user_pass PRIVATE tests/unit_tests/openvpn/mock_get_random.c tests/unit_tests/openvpn/mock_win32_execve.c
tests/unit_tests/openvpn/Makefile.am +22 -10
@@ -4,23 +4,17 @@ AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING) Unit-Tests' -test_binaries= +test_binaries = crypto_testdriver packet_id_testdriver auth_token_testdriver \ + ncp_testdriver misc_testdriver pkt_testdriver ssl_testdriver \ + user_pass_testdriver push_update_msg_testdriver provider_testdriver socket_testdriver if HAVE_LD_WRAP_SUPPORT test_binaries += argv_testdriver buffer_testdriver -endif - -test_binaries += crypto_testdriver packet_id_testdriver auth_token_testdriver ncp_testdriver misc_testdriver \ - pkt_testdriver ssl_testdriver user_pass_testdriver push_update_msg_testdriver - -if HAVE_LD_WRAP_SUPPORT if !WIN32 test_binaries += tls_crypt_testdriver endif endif -test_binaries += provider_testdriver - if WIN32 test_binaries += cryptoapi_testdriver LDADD = -lws2_32
@@ -343,4 +337,22 @@ $(top_srcdir)/src/openvpn/platform.c \ $(top_srcdir)/src/openvpn/push_util.c \ $(top_srcdir)/src/openvpn/options_util.c \ - $(top_srcdir)/src/openvpn/otime.c + $(top_srcdir)/src/openvpn/otime.c + +socket_testdriver_CFLAGS = \ + -I$(top_srcdir)/include -I$(top_srcdir)/src/compat -I$(top_srcdir)/src/openvpn \ + -DSOURCEDIR=\"$(top_srcdir)\" @TEST_CFLAGS@ + +socket_testdriver_LDFLAGS = @TEST_LDFLAGS@ $(SOCKETS_LIBS) + +socket_testdriver_SOURCES = test_socket.c \ + mock_msg.c test_common.h \ + mock_get_random.c \ + mock_management.c \ + $(top_srcdir)/src/openvpn/buffer.c \ + $(top_srcdir)/src/openvpn/win32-util.c \ + $(top_srcdir)/src/openvpn/platform.c \ + $(top_srcdir)/src/openvpn/env_set.c \ + $(top_srcdir)/src/openvpn/run_command.c \ + $(top_srcdir)/src/openvpn/socket_util.c +
tests/unit_tests/openvpn/mock_management.c +14 -0
@@ -46,4 +46,18 @@ {return NULL ; } + +void +management_set_state (struct management *man,const int state,const char *detail, +const in_addr_t *tun_local_ip,const struct in6_addr *tun_local_ip6, +const struct openvpn_sockaddr *local_addr, +const struct openvpn_sockaddr *remote_addr) +{ +} +#endif + +void +management_sleep (const int n) +{ +}
tests/unit_tests/openvpn/test_socket.c new file +111 -0
111 lines not on this page · raw message
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1160?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: If546f64a4554b292623bfcfe9ee53bac17dfa803
Gerrit-Change-Number: 1160
Gerrit-PatchSet: 3
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1160?usp=email
to look at the new patch set (#4).
Change subject: Add new unit test module test_socket
......................................................................
Add new unit test module test_socket
With a first UT that tests add_in6_addr() (andprint_in6_addr implicitly).
---
M CMakeLists.txt
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/mock_management.c
A tests/unit_tests/openvpn/test_socket.c
4 files changed, 177 insertions(+), 12 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/60/1160/4
CMakeLists.txt +15 -2
@@ -628,9 +628,11 @@ target_compile_options(openvpn PRIVATE -DPLUGIN_LIBDIR=\"${PLUGIN_DIR}\") find_library(resolv resolv) - # some platform like BSDs already include resolver functionality in the libc and not have an extra resolv library + # some platform like BSDs already include resolver functionality in the libc + # and do not have an extra resolv library if (${resolv} OR APPLE) - target_link_libraries(openvpn PUBLIC -lresolv) + set(RESOLV_LIBRARIES resolv) + target_link_libraries(openvpn PUBLIC ${RESOLV_LIBRARIES}) endif () endif ()
@@ -653,6 +655,7 @@ "test_packet_id" "test_pkt" "test_provider" + "test_socket" "test_ssl" "test_user_pass" "test_push_update_msg"
@@ -849,6 +852,16 @@ src/openvpn/base64.c ) + target_link_libraries(test_socket PUBLIC ${RESOLV_LIBRARIES}) + target_sources(test_socket PRIVATE + tests/unit_tests/openvpn/mock_get_random.c + tests/unit_tests/openvpn/mock_management.c + tests/unit_tests/openvpn/mock_win32_execve.c + src/openvpn/env_set.c + src/openvpn/run_command.c + src/openvpn/socket_util.c + ) + target_sources(test_user_pass PRIVATE tests/unit_tests/openvpn/mock_get_random.c tests/unit_tests/openvpn/mock_win32_execve.c
tests/unit_tests/openvpn/Makefile.am +22 -10
@@ -4,23 +4,17 @@ AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING) Unit-Tests' -test_binaries= +test_binaries = crypto_testdriver packet_id_testdriver auth_token_testdriver \ + ncp_testdriver misc_testdriver pkt_testdriver ssl_testdriver \ + user_pass_testdriver push_update_msg_testdriver provider_testdriver socket_testdriver if HAVE_LD_WRAP_SUPPORT test_binaries += argv_testdriver buffer_testdriver -endif - -test_binaries += crypto_testdriver packet_id_testdriver auth_token_testdriver ncp_testdriver misc_testdriver \ - pkt_testdriver ssl_testdriver user_pass_testdriver push_update_msg_testdriver - -if HAVE_LD_WRAP_SUPPORT if !WIN32 test_binaries += tls_crypt_testdriver endif endif -test_binaries += provider_testdriver - if WIN32 test_binaries += cryptoapi_testdriver LDADD = -lws2_32
@@ -343,4 +337,22 @@ $(top_srcdir)/src/openvpn/platform.c \ $(top_srcdir)/src/openvpn/push_util.c \ $(top_srcdir)/src/openvpn/options_util.c \ - $(top_srcdir)/src/openvpn/otime.c + $(top_srcdir)/src/openvpn/otime.c + +socket_testdriver_CFLAGS = \ + -I$(top_srcdir)/include -I$(top_srcdir)/src/compat -I$(top_srcdir)/src/openvpn \ + -DSOURCEDIR=\"$(top_srcdir)\" @TEST_CFLAGS@ + +socket_testdriver_LDFLAGS = @TEST_LDFLAGS@ $(SOCKETS_LIBS) + +socket_testdriver_SOURCES = test_socket.c \ + mock_msg.c test_common.h \ + mock_get_random.c \ + mock_management.c \ + $(top_srcdir)/src/openvpn/buffer.c \ + $(top_srcdir)/src/openvpn/win32-util.c \ + $(top_srcdir)/src/openvpn/platform.c \ + $(top_srcdir)/src/openvpn/env_set.c \ + $(top_srcdir)/src/openvpn/run_command.c \ + $(top_srcdir)/src/openvpn/socket_util.c +
tests/unit_tests/openvpn/mock_management.c +14 -0
@@ -46,4 +46,18 @@ {return NULL ; } + +void +management_set_state (struct management *man,const int state,const char *detail, +const in_addr_t *tun_local_ip,const struct in6_addr *tun_local_ip6, +const struct openvpn_sockaddr *local_addr, +const struct openvpn_sockaddr *remote_addr) +{ +} +#endif + +void +management_sleep (const int n) +{ +}
tests/unit_tests/openvpn/test_socket.c new file +126 -0
126 lines not on this page · raw message
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1160?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: If546f64a4554b292623bfcfe9ee53bac17dfa803
Gerrit-Change-Number: 1160
Gerrit-PatchSet: 4
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: flichtenheld, plaisthos.
cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/1160?usp=email )
Change subject: Add new unit test module test_socket
......................................................................
Patch Set 4: Code-Review+2
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1160?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: If546f64a4554b292623bfcfe9ee53bac17dfa803
Gerrit-Change-Number: 1160
Gerrit-PatchSet: 4
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Sun, 31 Aug 2025 15:11:07 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
PATCH v4 1/1 Add new unit test module test_socket
In reply to a message not in the archiveFrom: Frank Lichtenheld <[email protected]...>
With a first UT that tests add_in6_addr() (andprint_in6_addr implicitly).
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1160
This mail reflects revision 4 of this Change.
Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>
CMakeLists.txt +15 -2
@@ -628,9 +628,11 @@ target_compile_options(openvpn PRIVATE -DPLUGIN_LIBDIR=\"${PLUGIN_DIR}\") find_library(resolv resolv) - # some platform like BSDs already include resolver functionality in the libc and not have an extra resolv library + # some platform like BSDs already include resolver functionality in the libc + # and do not have an extra resolv library if (${resolv} OR APPLE) - target_link_libraries(openvpn PUBLIC -lresolv) + set(RESOLV_LIBRARIES resolv) + target_link_libraries(openvpn PUBLIC ${RESOLV_LIBRARIES}) endif () endif ()
@@ -653,6 +655,7 @@ "test_packet_id" "test_pkt" "test_provider" + "test_socket" "test_ssl" "test_user_pass" "test_push_update_msg"
@@ -849,6 +852,16 @@ src/openvpn/base64.c ) + target_link_libraries(test_socket PUBLIC ${RESOLV_LIBRARIES}) + target_sources(test_socket PRIVATE + tests/unit_tests/openvpn/mock_get_random.c + tests/unit_tests/openvpn/mock_management.c + tests/unit_tests/openvpn/mock_win32_execve.c + src/openvpn/env_set.c + src/openvpn/run_command.c + src/openvpn/socket_util.c + ) + target_sources(test_user_pass PRIVATE tests/unit_tests/openvpn/mock_get_random.c tests/unit_tests/openvpn/mock_win32_execve.c
tests/unit_tests/openvpn/Makefile.am +22 -10
@@ -4,23 +4,17 @@ AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING) Unit-Tests' -test_binaries= +test_binaries = crypto_testdriver packet_id_testdriver auth_token_testdriver \ + ncp_testdriver misc_testdriver pkt_testdriver ssl_testdriver \ + user_pass_testdriver push_update_msg_testdriver provider_testdriver socket_testdriver if HAVE_LD_WRAP_SUPPORT test_binaries += argv_testdriver buffer_testdriver -endif - -test_binaries += crypto_testdriver packet_id_testdriver auth_token_testdriver ncp_testdriver misc_testdriver \ - pkt_testdriver ssl_testdriver user_pass_testdriver push_update_msg_testdriver - -if HAVE_LD_WRAP_SUPPORT if !WIN32 test_binaries += tls_crypt_testdriver endif endif -test_binaries += provider_testdriver - if WIN32 test_binaries += cryptoapi_testdriver LDADD = -lws2_32
@@ -343,4 +337,22 @@ $(top_srcdir)/src/openvpn/platform.c \ $(top_srcdir)/src/openvpn/push_util.c \ $(top_srcdir)/src/openvpn/options_util.c \ - $(top_srcdir)/src/openvpn/otime.c + $(top_srcdir)/src/openvpn/otime.c + +socket_testdriver_CFLAGS = \ + -I$(top_srcdir)/include -I$(top_srcdir)/src/compat -I$(top_srcdir)/src/openvpn \ + -DSOURCEDIR=\"$(top_srcdir)\" @TEST_CFLAGS@ + +socket_testdriver_LDFLAGS = @TEST_LDFLAGS@ $(SOCKETS_LIBS) + +socket_testdriver_SOURCES = test_socket.c \ + mock_msg.c test_common.h \ + mock_get_random.c \ + mock_management.c \ + $(top_srcdir)/src/openvpn/buffer.c \ + $(top_srcdir)/src/openvpn/win32-util.c \ + $(top_srcdir)/src/openvpn/platform.c \ + $(top_srcdir)/src/openvpn/env_set.c \ + $(top_srcdir)/src/openvpn/run_command.c \ + $(top_srcdir)/src/openvpn/socket_util.c +
tests/unit_tests/openvpn/mock_management.c +14 -0
@@ -46,4 +46,18 @@ {return NULL ; } + +void +management_set_state (struct management *man,const int state,const char *detail, +const in_addr_t *tun_local_ip,const struct in6_addr *tun_local_ip6, +const struct openvpn_sockaddr *local_addr, +const struct openvpn_sockaddr *remote_addr) +{ +} +#endif + +void +management_sleep (const int n) +{ +}
tests/unit_tests/openvpn/test_socket.c new file +126 -0
126 lines not on this page · raw message
[Openvpn-devel] [PATCH applied] Re: Add new unit test module test_socket
Unit tests are good, especially if an integer-related change to one of the slightly more obscure functions is coming up :-) (and indeed, this function was so much nicer when it still had 32-bit additions...)
This patch does not add or change code in "openvpn itself", just adds a unit test module, based on the new socket_util.c in the previous commit. So not much to test, except look at BB (all green in v4) and test on GHA (also all green).
Your patch has been applied to the master branch.
commit 10d64c184404c532fe0861d5c57fb1613a608d4c
Author: Frank Lichtenheld Date: Sun Aug 31 17:11:26 2025 +0200
Add new unit test module test_socket
Signed-off-by: Frank Lichtenheld <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg32723.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
cron2 has uploaded a new patch set (#5) to the change originally created by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1160?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by cron2
Change subject: Add new unit test module test_socket
......................................................................
Add new unit test module test_socket
With a first UT that tests add_in6_addr() (andprint_in6_addr implicitly).
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg32723.html
---
M CMakeLists.txt
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/mock_management.c
A tests/unit_tests/openvpn/test_socket.c
4 files changed, 176 insertions(+), 12 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/60/1160/5
CMakeLists.txt +15 -2
@@ -628,9 +628,11 @@ target_compile_options(openvpn PRIVATE -DPLUGIN_LIBDIR=\"${PLUGIN_DIR}\") find_library(resolv resolv) - # some platform like BSDs already include resolver functionality in the libc and not have an extra resolv library + # some platform like BSDs already include resolver functionality in the libc + # and do not have an extra resolv library if (${resolv} OR APPLE) - target_link_libraries(openvpn PUBLIC -lresolv) + set(RESOLV_LIBRARIES resolv) + target_link_libraries(openvpn PUBLIC ${RESOLV_LIBRARIES}) endif () endif ()
@@ -653,6 +655,7 @@ "test_packet_id" "test_pkt" "test_provider" + "test_socket" "test_ssl" "test_user_pass" "test_push_update_msg"
@@ -849,6 +852,16 @@ src/openvpn/base64.c ) + target_link_libraries(test_socket PUBLIC ${RESOLV_LIBRARIES}) + target_sources(test_socket PRIVATE + tests/unit_tests/openvpn/mock_get_random.c + tests/unit_tests/openvpn/mock_management.c + tests/unit_tests/openvpn/mock_win32_execve.c + src/openvpn/env_set.c + src/openvpn/run_command.c + src/openvpn/socket_util.c + ) + target_sources(test_user_pass PRIVATE tests/unit_tests/openvpn/mock_get_random.c tests/unit_tests/openvpn/mock_win32_execve.c
tests/unit_tests/openvpn/Makefile.am +21 -10
@@ -4,23 +4,17 @@ AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING) Unit-Tests' -test_binaries= +test_binaries = crypto_testdriver packet_id_testdriver auth_token_testdriver \ + ncp_testdriver misc_testdriver pkt_testdriver ssl_testdriver \ + user_pass_testdriver push_update_msg_testdriver provider_testdriver socket_testdriver if HAVE_LD_WRAP_SUPPORT test_binaries += argv_testdriver buffer_testdriver -endif - -test_binaries += crypto_testdriver packet_id_testdriver auth_token_testdriver ncp_testdriver misc_testdriver \ - pkt_testdriver ssl_testdriver user_pass_testdriver push_update_msg_testdriver - -if HAVE_LD_WRAP_SUPPORT if !WIN32 test_binaries += tls_crypt_testdriver endif endif -test_binaries += provider_testdriver - if WIN32 test_binaries += cryptoapi_testdriver LDADD = -lws2_32
@@ -343,4 +337,21 @@ $(top_srcdir)/src/openvpn/platform.c \ $(top_srcdir)/src/openvpn/push_util.c \ $(top_srcdir)/src/openvpn/options_util.c \ - $(top_srcdir)/src/openvpn/otime.c + $(top_srcdir)/src/openvpn/otime.c + +socket_testdriver_CFLAGS = \ + -I$(top_srcdir)/include -I$(top_srcdir)/src/compat -I$(top_srcdir)/src/openvpn \ + -DSOURCEDIR=\"$(top_srcdir)\" @TEST_CFLAGS@ + +socket_testdriver_LDFLAGS = @TEST_LDFLAGS@ $(SOCKETS_LIBS) + +socket_testdriver_SOURCES = test_socket.c \ + mock_msg.c test_common.h \ + mock_get_random.c \ + mock_management.c \ + $(top_srcdir)/src/openvpn/buffer.c \ + $(top_srcdir)/src/openvpn/win32-util.c \ + $(top_srcdir)/src/openvpn/platform.c \ + $(top_srcdir)/src/openvpn/env_set.c \ + $(top_srcdir)/src/openvpn/run_command.c \ + $(top_srcdir)/src/openvpn/socket_util.c
tests/unit_tests/openvpn/mock_management.c +14 -0
@@ -46,4 +46,18 @@ {return NULL ; } + +void +management_set_state (struct management *man,const int state,const char *detail, +const in_addr_t *tun_local_ip,const struct in6_addr *tun_local_ip6, +const struct openvpn_sockaddr *local_addr, +const struct openvpn_sockaddr *remote_addr) +{ +} +#endif + +void +management_sleep (const int n) +{ +}
tests/unit_tests/openvpn/test_socket.c new file +126 -0
126 lines not on this page · raw message
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1160?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: If546f64a4554b292623bfcfe9ee53bac17dfa803
Gerrit-Change-Number: 1160
Gerrit-PatchSet: 5
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1160?usp=email )
Change subject: Add new unit test module test_socket
......................................................................
Add new unit test module test_socket
With a first UT that tests add_in6_addr() (andprint_in6_addr implicitly).
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg32723.html
---
M CMakeLists.txt
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/mock_management.c
A tests/unit_tests/openvpn/test_socket.c
4 files changed, 176 insertions(+), 12 deletions(-)
CMakeLists.txt +15 -2
@@ -628,9 +628,11 @@ target_compile_options(openvpn PRIVATE -DPLUGIN_LIBDIR=\"${PLUGIN_DIR}\") find_library(resolv resolv) - # some platform like BSDs already include resolver functionality in the libc and not have an extra resolv library + # some platform like BSDs already include resolver functionality in the libc + # and do not have an extra resolv library if (${resolv} OR APPLE) - target_link_libraries(openvpn PUBLIC -lresolv) + set(RESOLV_LIBRARIES resolv) + target_link_libraries(openvpn PUBLIC ${RESOLV_LIBRARIES}) endif () endif ()
@@ -653,6 +655,7 @@ "test_packet_id" "test_pkt" "test_provider" + "test_socket" "test_ssl" "test_user_pass" "test_push_update_msg"
@@ -849,6 +852,16 @@ src/openvpn/base64.c ) + target_link_libraries(test_socket PUBLIC ${RESOLV_LIBRARIES}) + target_sources(test_socket PRIVATE + tests/unit_tests/openvpn/mock_get_random.c + tests/unit_tests/openvpn/mock_management.c + tests/unit_tests/openvpn/mock_win32_execve.c + src/openvpn/env_set.c + src/openvpn/run_command.c + src/openvpn/socket_util.c + ) + target_sources(test_user_pass PRIVATE tests/unit_tests/openvpn/mock_get_random.c tests/unit_tests/openvpn/mock_win32_execve.c
tests/unit_tests/openvpn/Makefile.am +21 -10
@@ -4,23 +4,17 @@ AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING) Unit-Tests' -test_binaries= +test_binaries = crypto_testdriver packet_id_testdriver auth_token_testdriver \ + ncp_testdriver misc_testdriver pkt_testdriver ssl_testdriver \ + user_pass_testdriver push_update_msg_testdriver provider_testdriver socket_testdriver if HAVE_LD_WRAP_SUPPORT test_binaries += argv_testdriver buffer_testdriver -endif - -test_binaries += crypto_testdriver packet_id_testdriver auth_token_testdriver ncp_testdriver misc_testdriver \ - pkt_testdriver ssl_testdriver user_pass_testdriver push_update_msg_testdriver - -if HAVE_LD_WRAP_SUPPORT if !WIN32 test_binaries += tls_crypt_testdriver endif endif -test_binaries += provider_testdriver - if WIN32 test_binaries += cryptoapi_testdriver LDADD = -lws2_32
@@ -343,4 +337,21 @@ $(top_srcdir)/src/openvpn/platform.c \ $(top_srcdir)/src/openvpn/push_util.c \ $(top_srcdir)/src/openvpn/options_util.c \ - $(top_srcdir)/src/openvpn/otime.c + $(top_srcdir)/src/openvpn/otime.c + +socket_testdriver_CFLAGS = \ + -I$(top_srcdir)/include -I$(top_srcdir)/src/compat -I$(top_srcdir)/src/openvpn \ + -DSOURCEDIR=\"$(top_srcdir)\" @TEST_CFLAGS@ + +socket_testdriver_LDFLAGS = @TEST_LDFLAGS@ $(SOCKETS_LIBS) + +socket_testdriver_SOURCES = test_socket.c \ + mock_msg.c test_common.h \ + mock_get_random.c \ + mock_management.c \ + $(top_srcdir)/src/openvpn/buffer.c \ + $(top_srcdir)/src/openvpn/win32-util.c \ + $(top_srcdir)/src/openvpn/platform.c \ + $(top_srcdir)/src/openvpn/env_set.c \ + $(top_srcdir)/src/openvpn/run_command.c \ + $(top_srcdir)/src/openvpn/socket_util.c
tests/unit_tests/openvpn/mock_management.c +14 -0
@@ -46,4 +46,18 @@ {return NULL ; } + +void +management_set_state (struct management *man,const int state,const char *detail, +const in_addr_t *tun_local_ip,const struct in6_addr *tun_local_ip6, +const struct openvpn_sockaddr *local_addr, +const struct openvpn_sockaddr *remote_addr) +{ +} +#endif + +void +management_sleep (const int n) +{ +}
tests/unit_tests/openvpn/test_socket.c new file +126 -0
126 lines not on this page · raw message
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1160?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: If546f64a4554b292623bfcfe9ee53bac17dfa803
Gerrit-Change-Number: 1160
Gerrit-PatchSet: 5
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged